articles

Home / DeveloperSection / Articles / WrapPanel in WPF

WrapPanel in WPF

Anonymous User11154 13-Apr-2011

A WrapPanel element in XAML is used to create a WrapPanel control in WPF. WrapPanel control is similar to StackPanel control in functionality with one difference that WrapPanel control has built in Wrap functionality that means if the child control in WrapPanel is overflow then it is automatically arrange in next line as sequence. In the following demonstration I will told you that how to use WrapPanel control in WPF.

A XAML code snippet representing WrapPanel in WPF
<WrapPanel x:Name="wrapPanel1" Background="Beige" Orientation="Horizontal" >
            <Ellipse Width="100" Margin="10" Height="100" x:Name="ellipse1" Fill="Red"  />
            <Ellipse Width="100" Height="100" Fill="Pink" x:Name="ellipse2" Margin="10" />
            <Ellipse Width="100" Height="100" Fill="Orange" x:Name="ellipse3" Margin="10" />
            <Ellipse Width="100" Height="100" Fill="Green" x:Name="ellipse4" Margin="10" />
            <Ellipse Width="100" Height="100" Fill="Cyan" x:Name="ellipse5" Margin="10" />
            <Ellipse Width="100" Height="100" Fill="Goldenrod" x:Name="ellipse6" Margin="10" />
            <Ellipse Width="100" Height="100" Fill="Teal" x:Name="ellipse7" Margin="10" />
            <Ellipse Width="100" Height="100" Fill="Aquamarine" x:Name="ellipse8" Margin="10" />
</WrapPanel>
Output of the following code snippet is as follows

WrapPanel in WPF

WrapPanel in WPF

 


Updated 04-Mar-2020
I am a content writter !

Leave Comment

Comments

Liked By